import request from '@/utils/request';
import { stringify } from 'qs';

export async function allCategory(payload) {
  return request(`/category/all?type=${payload.type}`);
}

export async function saveCategory(payload) {
  return request(`/admin/category/add`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded;'
    },
    body: `${stringify(payload)}`
  });
}

export async function deleteCategory(payload) {
  return request(`/admin/category/delete/${payload.id}`);
}
